package com.example.whereismystuff.classes;

import java.util.ArrayList;

import android.graphics.Bitmap;

//import android.graphics.Bitmap;

/**
 * Item Class
 * @author The Null Pointers
 * Holds the information for all the Items
 */
public class Item{
	
	private boolean isFound = false, claimed = false;
	int reward = 0;


	private String city, state, description, name;
	private int zipCode;
	User poster, claimer;

	//Bitmap image;
	Bitmap image;
	
	/**
	 * Gets the image of the Item
	 * @return image
	 */
	public Bitmap getImage() {
		return image;
	}
	/**
	 * Sets the Image of the Item
	 * @param image
	 */
	public void setImage(Bitmap image) {
		this.image = image;
	}

	float[] location = new float[2];//Temporary	

	private String[] tags;
	int m_nUniqueID = -1;


	int m_nPosterID = -1;
	/**
	 * Item Constructor
	 * @param name
	 * @param description
	 * @param city
	 * @param state
	 * @param zipCode
	 * @param PosterID
	 * @param tags
	 */
	public Item(String name, String description, String city, 
			String state, int zipCode, int PosterID, /*Bitmap image,*/ String[] tags){
		this.name = name;
		this.description = description;
		this.city = city;
		this.state = state;
		this.zipCode = zipCode;
		
		m_nPosterID = PosterID;
		//this.image = image;
		this.tags = tags;
	}
	
	public Item(String name, String description, String city, 
			String state, int zipCode, User poster, /*Bitmap image,*/ String[] tags){
		this.name = name;
		this.description = description;
		this.city = city;
		this.state = state;
		this.zipCode = zipCode;
		this.poster = poster;
		
		if (poster != null)
			m_nPosterID = poster.getUniqueID();
		//this.image = image;
		this.tags = tags;
	}
	/**
	 * Get Name of Item
	 * @return name
	 */
	public String getName()
	{
		return this.name;
	}
	/**
	 * Get Description of Item
	 * @return description
	 */
	public String getDescription()
	{
		return this.description;
	}
	/**
	 * Get City of Item
	 * @return city
	 */
	public String getCity()
	{
		return this.city;
	}
	/**
	 * Get State of Item
	 * @return state
	 */
	public String getState()
	{
		return this.state;
	}
	/**
	 * Get ZipCode of Item
	 * @return zipCode
	 */
	public int getZipCode()
	{
		return this.zipCode;
	}
	/*public Bitmap getImage()
	{
		return this.image;
	}*/
	/**
	 * Get The person who posted the Item
	 * @return poster
	 */
	public User getPoster()
	{
		return poster;
	}
	/**
	 * Sets if the Item is claimed
	 * @param climed
	 */
	public void setIsClaimed(boolean claimed) {
		this.claimed = claimed;
	}
	/**
	 * Gets if the Item is claimed
	 * @return claimed
	 */
	public boolean getClaimed() {
		return this.claimed;
	}
	/**
	 * Sets if the item is found
	 * @param isFound
	 */
	public void setIsFound(boolean isFound) {
		this.isFound = isFound;
	}
	/**
	 * Get if the Item is found
	 * @return isFound
	 */
	public boolean getIsFound() {
		return this.isFound;
	}
	/**
	 * Gets the person who posted the item
	 * @return poster
	 */
	public String getPosterName()
	{
		return this.poster.getUserName();
	}
	/**
	 * Gets the tags for the item
	 * @return tags
	 */
	public String[] getTags()
	{

		return this.tags;
	}
	/**
	 * Return the id for the item
	 * @return uniqueID
	 */
	public int getUniqueID()
	{
		return this.m_nUniqueID;
	}
	/**
	 * Sets the UniqueId for the Item
	 * @param value
	 */
	public void setUniqueID(int value)
	{
		m_nUniqueID = value;
	}
	/**
	 * Sets the Name for the Item
	 * @param name
	 */
	public void setName(String name)
	{
		this.name = name;
	}
	/**
	 * returns if the item is found
	 * @return isFound
	 */
	public boolean isFound()
	{
		return isFound;
	}
	
	/**
	 * returns if the item is claimed
	 * @return claimed
	 */
	public boolean isClaimed()
	{
		return claimed;
	}
	/**
	 * Gets the location of the Item
	 * @return location
	 */
	public float[] getLocation() {
		return location;
	}
	/**
	 * Sets the location of the item
	 * @param location
	 */
	public void setLocation(float[] location) {
		this.location = location;
	}
	/**
	 * Returns the reward for the item
	 * @return reward
	 */
	public int getReward() {
		return reward;
	}
	/**
	 * Set the Reward for the item
	 * @param reward
	 */
	public void setReward(int reward) {
		this.reward = reward;
	}
	/**
	 * Sets the Poster for the Item
	 * @param user
	 */
	public void setPoster(User user)
	{
		poster = user;
	}
	/**
	 * Returns the person who has claimed the Item
	 * @return
	 */
	public User getClaimer() {
		return claimer;
	}
	/**
	 * Sets the User who has claimed the item
	 * @param claimer
	 */
	public void setClaimer(User claimer) {
		this.claimer = claimer;
	}
	/**
	 * To String method
	 * return string
	 */
	public String toString()
	{
		if (poster == null)
			return "(Name: " + name + " Poster: <none> City: " + city + ")";
		else
			return "(Name: " + name + " Poster: " + poster.getUserName() + " City: " + city + ")";
	}
	
}//End class